package com.huawei.appgallery.share.items;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import o.cwj.a;
import o.cwj.c;
import o.cwj.d;

public class ShareBottomSheet extends LinearLayout {
    private int ʻ;
    private View ʼ;
    private int ˊ;
    private boolean ˋ;
    private FrameLayout ˎ;
    private boolean ˏ;
    private Context ॱ;

    public ShareBottomSheet(Context context) {
        this(context, null);
    }

    public ShareBottomSheet(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public ShareBottomSheet(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ˊ = 0;
        this.ˏ = true;
        this.ˋ = false;
        this.ʻ = 0;
        this.ॱ = context;
        this.ˏ = true;
        LayoutInflater.from(context).inflate(d.ˏ, this, true);
        this.ʼ = findViewById(c.ᐝ);
        this.ʼ.setVisibility(0);
        this.ʼ.setOnClickListener(new 1(this));
        this.ˎ = (FrameLayout) findViewById(c.ˏ);
        this.ˎ.setBackgroundColor(context.getResources().getColor(a.ॱ));
    }

    public void ˋ(View view) {
        this.ˎ.addView(view);
    }

    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        this.ˎ.measure(i, MeasureSpec.makeMeasureSpec(0, 0));
        this.ˊ = this.ˎ.getMeasuredHeight();
        if (this.ˊ > this.ʻ) {
            this.ʻ = this.ˊ;
        }
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        if (!this.ˋ && this.ˏ) {
            this.ˋ = true;
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.ˎ, "TranslationY", new float[]{(float) this.ˊ, 0.0f});
            ofFloat.setDuration(200);
            ofFloat.start();
        }
        if (this.ʻ != 0) {
            LayoutParams layoutParams = this.ˎ.getLayoutParams();
            layoutParams.height = this.ʻ;
            this.ˎ.setLayoutParams(layoutParams);
        }
    }

    public void ˊ() {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.ˎ, "TranslationY", new float[]{0.0f, (float) this.ˊ});
        ofFloat.setDuration(200);
        ofFloat.start();
    }
}
